package LeetCode.leetcode704;

class Review1 {
    public int search(int[] nums, int target) {
        int l = 0;
        int r = nums.length-1;
        return fun(l,r,nums,target);
    }
    public static int fun(int left,int right, int[] nums,int target){
        if (left <= right){
            int mid = (left + right) / 2;
            if (target == nums[mid]) return mid;
            if (target < nums[mid]) return fun(left,mid-1,nums,target);
            return fun(mid+1,right,nums,target);
        }
        return -1;
    }
}
